
Default Key Bindings

                                               version: 7.4
                                               created: 03/08/94 {02:47:04 pm}
                                           last update: 11/30/00 {07:31:11 pm}


	  	Introduction


There are basically three different ways editor functions can be invoked:

     Directly via Alpha menus.
     Through menu equivalent key bindings
     Through key combinations other than menu equivalents. These 
      combinations include function keys and the numeric keypad.

It is the last two options that we are concerned with in this document.  By
default, Alpha has well over 300 different key bindings, far more than you
would ever want to memorize.  However, the bindings are there only for your
convenience.  You don't need to use any of them, but many people find that
using the mouse for common editing functions seriously slows them down.

To quickly find out what a specific key is bound to, use the menu item
"Config --> Describe Binding", and then press the key combination in
question.  If you look closer at the "Config" menu, you'll also see that F7
is bound to this menu item.  For example, type

	F7
	<command>-S

and you'll see that command-S is bound to 

	menu::fileProc "File" "save" 

(command is the "Apple" key on the Macintosh, by the way, and "alt" on a PC)

Sometimes the information given by F7 will seem somewhat cryptic, because
these are the actual Tcl commands, but in general it is easy to decipher
what is going on.

If you take a look at the "File" menu, you'll see that "Save" also gives
the key binding information -- if you find yourself using the same menu
commands over and over again, learning a few of these bindings can save a
lot of time and travel of the mouse.

The "Config --> List All Bindings" menu item will list all current key
bindings, or you could just click here --> <<global::listAllBindings>>.  If
you want more information regarding what an item does, command double-click
on the listed Tcl procedure to open the file containing its definition.


	======================================================================


	  	Global Key Bindings


The following is a list of some of the most commonly used key bindings in
Alpha's default setup, those that are generally not listed in any menus:


	  	 	Help

'help'									open the "Alpha Manual" help file


	  	 	Moving the Cursor


left-arrow           or  control-b      backward character
right-arrow          or  control-f      forward character
up-arrow             or  control-p      previous-line
down-arrow           or  control-n      next-line

option-left-arrow    or  option-b       backward one word
option-right-arrow   or  option-f       forward one word

command-left-arrow   or  control-a      beginning of line
command-right-arrow  or  control-e      end of line
command-up-arrow     or  'home'         beginning of window
command-down-arrow   or  'end'          end of window

'pgup'                                  move one page backward
'pgdn'                                  move one page forward


	  	 	Selecting Text


shift-left-arrow                        extend selection one char left
shift-right-arrow                       extend selection one char right

shift-up-arrow                          extend selection one line up
shift-down-arrow                        extend selection one line down

shift-option-left-arrow                 extend selection one word left
shift-option-right-arrow                extend selection one word right

control-h                               select next word

shift-command-left-arrow                select to beginning of line
shift-command-right-arrow               select to end of line


	  	 	Deleting Text


'del'      or  control-d        delete forward char
'delete'                        delete backward char
option-d                        delete forward word
option-h   or  option-delete    delete backward word
control-k                       delete to end of line


	  	 	Twiddle, Shifting Text


The following functions are found in the Text menu.

Twiddle (command-`)                  Exchange characters bracketing 
                                     the selection point.
Twiddle Words (command-option-`)     Exchange words bracketing the 
                                     selection point.

Shift Left (command-[)               Shift selection left one tab.
Shift Left Space (command-option-[)  Shift selection left one space.
Shift Right (command-])              Shift selection right one tab.
Shift Right Space (command-option-]) Shift selection right one space.


	  	 	The Numeric Key Pad


Alpha starts up with the Num Lock off so that the numeric key pad can be
used as a navigation tool.

0   Scroll back one page 
1   Jump to the start of the nearest function above the current position * 
2   No special function; types a "2" 
3   Jump to the start of the nearest function below the current position * 
4   Move to beginning of current word 
5   Marks current insertion point and moves cursor to previous mark. 

    Note: This is extremely useful for navigating across text chunks.  Try
    'paste'-ing a large chunk of text, and then immediately hit Keypad 5.  

	Try 'put cursor at top/bottom of document' (Keypad 0 or .), and then
	immediately hit Keypad 5.  After a few minutes, you won't be able to
	live without Keypad 5...

6   Move to end of current word 
7   Delete all characters from current insertion point to beginning of word 
8   Put cursor at top of document (new in 7.4.x) 
9   Delete all characters from current insertion point to end of word 

.   Put cursor at bottom of document 
+   Cycles between the two topmost windows 
-   Makes the previous window topmost 

shift-clear   Turns num lock off, allowing you to use the keypad for numbers
clear         Move the current line to the top of the window
enter         Page forward 

* Note: in modes where no function specifying pattern exist, 1 and 3 just
look for parenthesis (e.g. text mode).  Also, in Tcl trace dumps these keys
help follow Tcl calls and returned values (advanced stuff)

The =, /, * keys function normally.

To turn off these special navigation functions, turn on the Num Lock (using 
shift-clear).

Turning the Num Lock off will recover the navigation features of the
numeric key pad.


	======================================================================


	  	Mode Specific Bindings


Be aware that each file has a "mode" associated with it that may define
additional key bindings.  The "Config --> Mode Prefs --> Describe Mode"
menu item will list mode-specific key bindings (for the mode of the current
window).

LaTeX specific key bindings can also be found in "latexKeys.tcl".


	======================================================================


	  	User Defined Key bindings
        

Any Tcl command can be bound to any single keystroke. One way to bind a 
function is with a statement such as:
  
	Bind 'c' <modifier string> funcName [<mode>]
          
where c is a character, <modifier string> is an optional string containing 
one or more of:

      c   - command modifier
      o   - option modifier
      s   - shift modifier
      z   - control modifier
      e   - escape modifier      

'mode' is an optional parameter that specifies, when present, that the
binding is only active in a given mode.  Note that given a general binding
(no mode specification) and a binding specific to the current mode, the
last binding to have been created is the one found first.

For example, the following line binds cmd-shift-f to the function
'forwardChar':

	Bind 'f' <cs> forwardChar

Additionally, the modifier string can contain a capital letter specifying
that the binding is only activated if preceded by control and the lowercase
version of that letter.  This feature allows multiple-key combinations a la
Emacs.  This requires that ctrl-<the character> is bound to the function
'prefixChar'.  By default ctrl-C, ctrl-Q, and ctrl-X are bound to
'prefixChar'.  The next line would bind 'forwardChar' to ctrl-x ctrl-f:

	Bind 'f' <cX> forwardChar 

Additionally, most keyboards have keypads and/or function keys.  These keys
can be bound using case-insensitive numeric labels using the same bind
command as above, with the label replacing the character.  For example, to
bind F1 to function 'funcName', the following would work:

	Bind F1 funcName

As above, the binding can include a modifier string.  The following labels
are defined:

  Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 Help Home Pgup Del 
  End Pgdn Left Right Up Down Clear Kpad0 Kpad1 Kpad2 Kpad3 Kpad4 Kpad5
  Kpad6 Kpad7 Kpad8 Kpad9 Kpad= Kpad/ Kpad* Kpad- Kpad+ Enter Kpad.

The above labels may not be sufficient for all keyboards (attention
international users).  In particular there are some problems when binding
to accented characters (more about that below).  If a hex number is used
instead of a character inside the single quotes, the binding is done to key
codes instead of ascii values.  The following is a key code version of the
same binding:

	Bind 0x03 <cs> forwardChar

The key code for any given key can be obtained by selecting the menu item
"Utils --> Ascii Etc --> Key Code" and then typing the key.  Alpha then
types the key code.

Also, there is an alternate form that allows the specification of an ascii
code directly:

	ascii 0x20 <z> setMark
    
Binds control-space to 'setMark'.  The ascii code for any given key can be
obtained by selecting the menu item "Utils --> Ascii Etc --> Key Ascii" and
then typing the key.  Alpha then types the ascii code.

Note that menu item command equivalents take precedence over bindings, and
that the 'Bind' command does not affect the command equivalents displayed
in the menus.  Also note that key code bindings take precedence over ascii
bindings.

Finally, there are 'unBind' and 'unascii' functions, with identical
arguments to their counterparts.


	  	 	Bindings to accented characters


To bind to an accented character is not always as straight forward as
binding to an un-accented one.

Accented characters which can be typed directly without using a dead key,
you can bind to them as long as they have a modifier different from <s>. 
As an example with a French keyboard

	Bind '' <c> ...
	Bind '' <z> ...
    
works fine, but

	Bind '' ...
	Bind '' <s> ...
    
does not. In the latter case the key code has to be used instead:

	Bind 0x13 ...
	Bind 0x13 <s> ...

Accented characters which are obtained using a dead key has to be bound
using ascii, e.g '' on a French keyboard:

	ascii 0x93 ...


	  	 	What to bind to?


When you want to define a new key binding you obviously want to use a key
combination which is not already in use.  There are two different ways to
find if a key combination is free.

First, the menu item "Config --> List All Bindings" will list all of the
bindings currently in effect.

Second, you can use "Config --> Describe Binding" to find what a certain
key combination is bound to.  Select "Config --> Describe Binding" and then
hit the key combination you are interested in.  Alpha will then display a
dialog saying which function the key combination is bound to, or "Key
combination unbound."  if it is not bound to anything.

There is one thing to note about bindings involving the shift key.  If
there is nothing bound to a key combination including the shift key, typing
this key combination will have the same effect as the one wihout the shift
key.  A specific example to clarify this: command-P is bound to "print",
but there is no binding defined for command-shift-P. Still hitting
command-shift-P has the same effect as hitting command-P. But if you now
define a new binding for command-shift-P, then command-P and
command-shift-P will have different functionality.


	======================================================================


Author: Pete Keheler

Default Key Bindings updated by Craig Barton Upright, Donavan Hall.

E-mail: <cupright@princeton.edu>
  mail: Princeton University,  Department of Sociology 
        Princeton, New Jersey  08544  USA
   www: <http://www.princeton.edu/~cupright/>

E-mail: <hall@magnet.fsu.edu>
